<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <!-- 监视滚动条滚动的距离 动态的给图片设置src属性的值 -->
  <div style="height: 3000px"></div>
  <img src="" alt="">
  <script>
    // window.onscroll = function() {
    //   if(window.pageYOffset > 2000) {
    //     document.querySelector('img').src='https://img2.baidu.com/it/u=1121490367,413195985&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1667667600&t=44ffafdafa0b28425ad0126d9b57c259'
    //   }
    // }
 
  </script>
</body>
</html>